Skip to main content

Setting up automatic versioning

Conventional commits​

We use conventional commits to automatically generate release notes and version numbers. This can in turn be used to automatically create releases in github. In the next section we will go through how to set this up.

Check out the getting started page for more information.

Setting up automatic versioning​

Setting up the automatic versioning requires some setup in the github repo:

  1. Set workflow permissions to "Read and write permissions" under https://github.com/gjensidige/your-repo-name/settings/actions
  2. Give the gjensidige-bot the write role in https://github.com/gjensidige/your-repo-name/settings/access
  3. Add ACTIONS_SYSTEM_USER to the repo using the github slack bot if it's not already added
  4. Copy the workflow file pr-create-release.yml to your workflows, from here
  5. Add the release.config.js to your repo, defaults to using main as release branch, from here

Setting up python automatic versioning​

If you try to install a python package using pip, you might have run into issues of it not updating the package because it thinks it's already installed.

And according to pip it probably is, but you want it to update to the latest version. Pip uses the version number to determine if it should update the package or not.

Using the following steps you can set up automatic versioning for your python package based on the release tag which is created in the previous section.

  1. In your main branch protection rules, enable "Allow specified actors to bypass required pull requests" and add gjensidige-bot to the list, https://github.com/gjensidige/your-repo-name/settings/branch_protection_rules
  2. Add the update-version github action to your repository from here
  3. Add the update_version.py script to the root of your repository from here

This assumes that you have a setup.cfg file in the root of your repository with a version number in it.